import { Component } from '@angular/core';
import {App, IonicPage, NavController, NavParams} from 'ionic-angular';
import {RentStoreDetailPage} from "../rent-store-detail/rent-store-detail";
import {ROUTER} from "../../service/router.service";
import {GOODS} from "../../api/goods-api";
import {LocalStorage} from "../../utils/localstorage.utils";
import {GoodModel} from "../../model/good.model";

/**
 * Generated class for the RentStorePage page.
 *
 * See http://ionicframework.com/docs/components/#navigation for more info
 * on Ionic pages and navigation.
 */
@IonicPage()
@Component({
  selector: 'page-rent-store',
  templateUrl: 'rent-store.html',
})
export class RentStorePage {
  commoditys=[]

  constructor(public ls:LocalStorage,private GOODS:GOODS,public navCtrl: NavController,public app:App,public navParams: NavParams,private ROUTER: ROUTER) {
  }

  gotoRentStoreDetail(v) {
    this.ROUTER.go(ROUTER.RENTSTOREDETAIL,v.id);
    this.ls.setObject('good',new GoodModel(v));
  }


  ionViewDidLoad() {
    console.log('ionViewDidLoad RentStorePage');
    this.GOODS.getList({type:1,size:999},(v)=>{
      this.commoditys = v.content
    })
  }
  ionViewDidEnter() {
    document.title='租赁商城';
  }
}
